package com.dixon.worddayday.config;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceHttpClientImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author dixon
 * @since 2025-11-21
 */
@Configuration
@EnableConfigurationProperties({WxProperties.class})
public class AppConfiguration {
	@Resource
	private WxProperties wxProperties;

	@Bean
	public WxMaService getWxMaService() {
		WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
		config.setAppid(wxProperties.getAppId());
		config.setSecret(wxProperties.getSecret());

		WxMaService wxMpService = new WxMaServiceHttpClientImpl();
		wxMpService.setWxMaConfig(config);

		return wxMpService;
	}

//	@Bean
//	public WxMpQrcodeService getWxMpQrcodeService() {
//		return new WxMpQrcodeServiceImpl(getWxMpService());
//	}
}
